package cn.zktr.Personnel.controllers.zhouxiong;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.zktr.Personnel.model.pojos.*;
import cn.zktr.Personnel.model.service.zhouxiong.*;
import cn.zktr.Personnel.model.service.zhouyongcong.*;

@Controller
public class BanZuController {
	
	@Autowired
	private getUitlsService gus;

	@Autowired
	private JiChuService jichu;
	
	@RequestMapping("zx/ban-zu")
	public void zhujiemian() {}
	
	@RequestMapping("BanZu")
	@ResponseBody
	public Map<String,Object> bazu(int page,int rows) {
		Map<String,Object> map = new HashMap<>();
		map.put("total",jichu.selectBanZu().size());
		Page<Object> p=PageHelper.startPage(page,rows);
		JSONArray findAll=jichu.selectBanZu();
		//页内容
		map.put("rows",findAll);
		return map;
	}
	
	@PostMapping("updateBZ")
	@ResponseBody
	public String updateHZ(Integer temid,Integer deptid,Integer empid,String temname,Integer temrs,String temrem) {
		String bz = jichu.updateBZ( temid, deptid, empid, temname, temrs, temrem);
		return bz;
	}
	
	@PostMapping("deleteBZ")
	@ResponseBody
	public String deleteBZ(Integer temid) {
		jichu.deleteBZ(temid);
		return "";
	}
	
}
